package com.baitengsoft.patentapimonitor.api.dao;

import com.baitengsoft.patentapimonitor.api.entity.RptPatentDataAreaEntity;
import com.baitengsoft.patentapimonitor.api.model.*;
import com.baitengsoft.patentapimonitor.api.model.param.WebPatentApplySearchParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Chen 2017/12/25
 */
@Mapper
@Repository
public interface RptpatentDataAreaDao extends BasetkRepository<RptPatentDataAreaEntity> {

    /**
     * 目标总和 使用选中年
     */
    List<RptPatentDataAreaSumInfo> getRptSumDataBySelectYear(@Param("sum") String sum, @Param("selectYear") String selectYear, @Param("list") List<Integer> areaIds);

    /**
     * 目标总和和总和（算完成率） 使用选中年月
     */
    RptPatentDataAreaSumInfo getRptSumDataBySelectDate(@Param("sum") String sum, @Param("targetsum") String targetsum, @Param("selectDate") Integer selectedDate, @Param("list") List<Integer> areaIds);

    /**
     * 根据平台id查询申请趋势
     */
    List<WebYearStatisticInfo> getApplyTrendListByPlatformId(@Param("platformid") Integer platformid);

    /**
     * 根据平台id查询授权趋势
     */
    List<WebYearStatisticInfo> getAuthorizeTrendListByPlatformId(@Param("platformid") Integer platformid);

    /**
     * 概览页申请趋势
     */
    List<WebYearStatisticInfo> getApplyTrendListForHome(@Param("platformid") Integer platformid);

    /**
     * 概览页授权趋势
     */
    List<WebYearStatisticInfo> getAuthorizeTrendListForHome(@Param("platformid") Integer platformid);


    /**
     * 根据年份查询申请趋势
     */
    List<WebYearStatisticInfo> getApplyTrendListByPlatformIdAndYear(@Param("platformid") Integer platformid, @Param("selectYear") Integer selectYear);

    /**
     * 根据年份查询授权趋势
     */
    List<WebYearStatisticInfo> getAuthorizeTrendListByPlatformIdAndYear(@Param("platformid") Integer platformid, @Param("selectYear") Integer selectYear);

    /**
     * 根据平台id查询
     */
    List<WebAreaStatisticInfo> getWebAreaStatisticInfoByPlatFormId(@Param("platformid") Integer platformid,
                                                                   @Param("DateYM") Integer DateYM,
                                                                   @Param("order") String order,
                                                                   @Param("sort") String sort);

    /**
     * 获取所有的乡镇统计
     * @param platformid
     * @param order
     * @param sort
     * @return
     */
    List<WebAreaStatisticInfo> getWebAreaStatisticAllInfoByPlatFormId(@Param("platformid") Integer platformid,
                                                                   @Param("order") String order,
                                                                   @Param("sort") String sort);


    /**
     * 【概览】获取当前有效发明
     */
    WebBaseAnalysisInfo getCurrentYxcount(@Param("platformid") Integer platformid);

    /**
     * 【概览】今年新增公开
     */
    WebBaseAnalysisInfo getXzcountYear(@Param("platformid") Integer platformid,
                                       @Param("startDate") Date startDate,
                                       @Param("endDate") Date endDate
    );

    /**
     * 【概览】获取今年新增授权
     */
    WebBaseAnalysisInfo getSqcountYear(@Param("platformid") Integer platformid,
                                       @Param("startDate") Date startDate,
                                       @Param("endDate") Date endDate
    );

    /**
     * 根据时间范围获取有效发明合计
     */
    Integer getYXFMCountByDateYM(@Param("platformid") Integer platformid, @Param("dateYM") Integer dateYM);

    /**
     * 获取有效专利区域分析[未分区域]
     */
    WebAreaStatisticInfo getWebAreaStatisticInfoUnllArea(@Param("platformid") Integer platformid);


    /**
     * 获取首页相关统计信息
     *
     * @param platformid
     * @return
     */
    WebStatisticsInfo getIndexStatisticsInfo(@Param("platformid") Integer platformid);


    /**
     * 获取所有专利，按照类型进行统计
     * @param params
     * @return
     */
    WebStatisticsTotal getStaticTotal(Map<String,Object> params);


}
